﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using OnlineManagement.Common;
using System.Data;
namespace OnlineManagement.Web
{
    public partial class _Default : System.Web.UI.Page
    {
        string siteURL;
        protected void Page_Load(object sender, EventArgs e)
        {
           // QueryURLTest();
            btnLog.Click += new EventHandler(btnLog_Click);
            if(!Page.IsPostBack){
                //InitPage();
                double a = 17*1.0;
                double b = 18*1.0;

                double f = a / b;
              
                Label1.Text = f.ToString("P");
              // log4net.ILog log= OnlineHoggeryLog.GetLog("demo");
               //log.Info(new Com.HoggeryLog() {HoggeryID=1001,PigId=Guid.NewGuid().ToString(),BusinessLogDate=DateTime.Parse("2014-12-01") });
            }
        }

        void btnLog_Click(object sender, EventArgs e)
        {
            log4net.ILog log4 = OnlineHoggeryLog.GetLog(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString());

            Com.HoggeryLog HLlog = new Com.HoggeryLog()
            {
                HoggeryID = 0,
                Message = "this is from log test",
                BusinessLogDate = DateTime.Now
            };
            log4.Info(HLlog);
            btnLog.Text = "Log Test Done";
        }
        private void InitPage() {
            string action = Request["Action"];
            if(!string.IsNullOrEmpty(action)){
             string str=   Common.JsonHelper.DataTableToJson("", BindData().Tables[0]);
             Response.Write(str);
             Response.End();
            }
        }
      
        public DataSet BindData()
        {
            DataTable dtData = new DataTable();
            dtData.Columns.Add("id");
            dtData.Columns.Add("name");
            dtData.Columns.Add("sex");
            DataRow drData;
            drData = dtData.NewRow();
            drData[0] = 16;
            drData[1] = "zhaoliu";
            drData[2] = "man";
            dtData.Rows.Add(drData);
            drData = dtData.NewRow();
            drData[0] = 19;
            drData[1] = "zhangsan";
            drData[2] = "women";
            dtData.Rows.Add(drData);
            DataSet ds = new DataSet();
            ds.Tables.Add(dtData);
            return ds;
        }

    }
}
